from config import BASE_URL


class OBJ_Login(object):
    def __init__(self, session):
        self.session = session

    def get_jpg_code(self, r):
        url = BASE_URL + f'/common/public/verifycode1/{r}'
        resp = self.session.get(url)
        return resp

    def get_dx_code(self, phone_v, imgVerifyCode_v, type_v):
        url = BASE_URL + '/member/public/sendSms'
        info = {"phone": phone_v, 'imgVerifyCode': imgVerifyCode_v, "type": type_v}
        resp = self.session.post(url, data=info)
        return resp

    def get_zc_ok(self, phone_v, password_v, verifycode_v, phone_code_v, dy_server_v):
        url = BASE_URL + '/member/public/reg'
        info = {"phone": phone_v, "password": password_v, "verifycode": verifycode_v,
                "phone_code": phone_code_v, "dy_server": dy_server_v}
        resp = self.session.post(url, data=info)
        return resp

    def get_dl_ok(self, keywords_v, password_v):
        url = BASE_URL + '/member/public/login'
        info = {"keywords": keywords_v, "password": password_v}
        resp = self.session.post(url, data=info)
        return resp
